import { Body, Controller, Delete, Get, Param, Patch, Post, Query, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { AuthUser } from 'src/user/customDecorator';
import { RoleService } from './role.service';

@UseGuards(AuthGuard('jwt'))
@Controller('role')
export class RoleController {
    constructor(
        private readonly roleService: RoleService,
    ) { }

    @Post()
    create(@Body() body: any) {
        return this.roleService.create(body)
    }

    @Delete(':id')
    remove(@Param('id') id: string) {
        return this.roleService.remove(+id);
    }

    @Patch(':id')
    update(@Param('id') id: number, @Body() body: any) {
        return this.roleService.update(id, body);
    }

    @Get('routes')
    getAllRoutes() {
        return this.roleService.getAllRoutes()
    }

    @Get()
    info(@Query() query: any) {
        return this.roleService.getRoles(query);
    }
}
